feat(bigtable): route single-entry MutateRows through a point-write c… - #14028
Merged
Conversation
…allable Add MaybePointWriteCallable, mirroring MaybePointReadCallable: a BulkMutation with exactly one entry is converted to a RowMutation and dispatched through a point-write callable so it can benefit from the session-shim diversion, while multi-entry bulk mutations continue through the classic MutateRows path. The point-write callable falls back to the MutateRow RPC when the session diversion does not apply, but carries the caller's bulkMutateRowsSettings retry settings/codes so a single-entry bulk write retries the same way it would have as a MutateRows call.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces MaybePointWriteCallable to route single-entry BulkMutations through a unary point-write callable (MutateRow RPC) instead of the classic bulk mutation path, allowing them to benefit from session-shim diversion. It also updates EnhancedBigtableStub to integrate this new callable and adds corresponding unit tests. The review feedback suggests adding a test case to verify that a BulkMutation with zero entries is correctly routed to the classic bulk mutation path.
Comment on lines
+66
to
+77
| @Test | ||
| public void multipleEntries_fallsThroughToClassic() { | ||
| BulkMutation request = | ||
| BulkMutation.create(TABLE_ID) | ||
| .add("row-a", Mutation.create().deleteRow()) | ||
| .add("row-b", Mutation.create().deleteRow()); | ||
|
|
||
| callable.futureCall(request, null); | ||
|
|
||
| assertThat(pointWriter.request).isNull(); | ||
| assertThat(classic.request).isEqualTo(request); | ||
| } |
Contributor
There was a problem hiding this comment.
Add a test case to verify that a BulkMutation with zero entries is correctly routed to the classic bulk mutation path instead of the point-write path.
@Test
public void multipleEntries_fallsThroughToClassic() {
BulkMutation request =
BulkMutation.create(TABLE_ID)
.add("row-a", Mutation.create().deleteRow())
.add("row-b", Mutation.create().deleteRow());
callable.futureCall(request, null);
assertThat(pointWriter.request).isNull();
assertThat(classic.request).isEqualTo(request);
}
@Test
public void zeroEntries_fallsThroughToClassic() {
BulkMutation request = BulkMutation.create(TABLE_ID);
callable.futureCall(request, null);
assertThat(pointWriter.request).isNull();
assertThat(classic.request).isEqualTo(request);
}The point-write callable used by MaybePointWriteCallable previously fell back to the MutateRow RPC when the session shim did not divert traffic. Unlike point reads (where the single-row read is just ReadRows with a limit), MutateRow and MutateRows are distinct RPCs, so this changed the wire behavior for single-entry bulk mutations and broke tests that only implement MutateRows. Build the fallback classic so it delegates to the bulk MutateRows callable as a single-entry batch, then let the shim decorate it. When the shim diverts, the mutation goes to the session single-row write API; otherwise it stays on MutateRows with the bulk operation's retry behavior. This removes the need for the nullable/reference-equality check on the shim's return value.
nimf
approved these changes
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…allable
Add MaybePointWriteCallable, mirroring MaybePointReadCallable: a BulkMutation with exactly one entry is converted to a RowMutation and dispatched through a point-write callable so it can benefit from the session-shim diversion, while multi-entry bulk mutations continue through the classic MutateRows path.
The point-write callable falls back to the MutateRow RPC when the session diversion does not apply, but carries the caller's bulkMutateRowsSettings retry settings/codes so a single-entry bulk write retries the same way it would have as a MutateRows call.